package me.zingon.self.bigdispatcher.constant;

import lombok.Getter;

/**
 * @author ztc 1423047407@qq.com
 * @version 1.0
 * @date 2021-1-21 13:40
 */
@Getter
public enum JOB_STATUS {
    /**
     * 执行中
     */
    RUNNING(0,"执行中"),

    /**
     * 已暂停
     */
    PAUSE(1,"已暂停"),

    /**
     * 已停止
     */
    STOP(2,"已停止"),

    /**
     * 准备好
     */
    REDAY(3,"已就绪");

    Integer code;
    String msg;

    JOB_STATUS(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static String toMsg(Integer code){
        JOB_STATUS[] statuses = JOB_STATUS.values();
        for (JOB_STATUS status: statuses){
            if(status.code.equals(code)){
                return status.msg;
            }
        }
        return "unknow";
    }

}
